<template>
  <div>
    <van-field
      v-model="sms"
      center
      clearable
      placeholder="添加代办事项"
      @keydown.13="par"
    >
      <template #button>
        <van-button
          :style="{ background: cd, border: 0 }"
          size="small"
          type="primary"
          @click="par"
          >提交</van-button
        >
      </template>
    </van-field>
  </div>
</template>

<script>
export default {
  props: ["cd"],
  data() {
    return {
      sms: "",
    };
  },
  methods: {
    par() {
      if (this.sms != "") {
        this.$emit("par", this.sms);
        this.sms = "";
      } else {
        alert("输入不能为空");
        return false;
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.but1 {
  background-color: #f39894;
  border: 2px #f39894 solid;
}
</style>
